﻿using System.ComponentModel.DataAnnotations;


namespace Sita.Entities
{
    //[MetadataType(typeof(Metadata.Module))]
    public partial class Module
    {
        public string LocalizedName
        {
            get
            {
                System.Reflection.PropertyInfo NameInfo;
                object NameValue;

                NameInfo = typeof(Resources.ModuleNames).GetProperty(this.Code,
                    System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);

                if (NameInfo != null && 
                    (NameValue = NameInfo.GetValue(typeof(Resources.ModuleNames), null)) != null)
                {
                    return NameValue.ToString();
                }

                return this.Name;
            }
        }
    }
}
